﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using CellphoneRepair.DAL;
using CellphoneRepair.Entities;
using DevExpress.XtraEditors;

namespace CellphoneRepair.Forms
{
    public partial class AddPinpai : DevExpress.XtraEditors.XtraForm
    {
        public AddPinpai()
        {
            InitializeComponent();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textEdit1.Text))
            {
                pinpai.pinpai = textEdit1.Text;

                using (PinpaiBll bll = new PinpaiBll())
                {
                    bll.Insert(pinpai);
                }
                DialogResult = DialogResult.OK;
                
            }
        }

        private Pinpai pinpai = new Pinpai();

        private void AddPinpai_Load(object sender, EventArgs e)
        {
            pinpai.Idpinpai = Commons.GenerateIdByForeTag("PP");
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }
    }
}